class_name GameplayTagManager
extends Node
## Gameplay Tag Manager
## Version: 0.1.0

##
var _gameplay_tags: Array[String] = []


#region Add
func add_tag(tag: String) -> void:
	if not _gameplay_tags.has(tag):
		_gameplay_tags.append(tag)


func add_tags(tags: Array[String]) -> void:
	for tag: String in tags:
		add_tag(tag)
#endregion


#region Delete
func remove_tag(tag: String) -> void:
	for gameplay_tag: String in _gameplay_tags:
		if gameplay_tag.begins_with(tag):
			_gameplay_tags.erase(gameplay_tag)
#endregion


#region Find
func has_tag(tag: String) -> bool:
	for gameplay_tag: String in _gameplay_tags:
		if gameplay_tag.begins_with(tag):
			return true
	return false


func has_any_tags(tags: Array[String]) -> bool:
	for tag: String in tags:
		if has_tag(tag):
			return true
	return false


func has_all_tags(tags: Array[String]) -> bool:
	for tag: String in tags:
		if not has_tag(tag):
			return false
	return true


func get_all_tags() -> Array[String]:
	return _gameplay_tags
#endregion
